package net.aiion.weave.impl.xml.events;

import net.aiion.weave.spi.xml.events.DocumentStartXmlEvent;

public class DocumentStartXmlEventImpl extends XmlEventImpl implements DocumentStartXmlEvent
{
    private final String version;
    private final String encoding;
    private final boolean standalone;

    public DocumentStartXmlEventImpl(final String aVersion, final String anEncoding, final boolean isStandalone) {
        version = aVersion;
        encoding = anEncoding;
        standalone = isStandalone;
    }

    @Override
    public int getType() {
        return START_DOCUMENT;
    }

    @Override
    public String getVersion() {
        return version;
    }

    @Override
    public String getEncoding() {
        return encoding;
    }

    @Override
    public boolean isStandalone() {
        return standalone;
    }

    @Override
    public String toString() {
        final StringBuilder builder = new StringBuilder();
        builder.append("XmlStartDocumentImpl[version=");
        builder.append(version);
        builder.append(", encoding=");
        builder.append(encoding);
        builder.append(", standalone=");
        builder.append(standalone);
        builder.append("]");
        return builder.toString();
    }
}
